package model;

public class Peca {

	//Atributos
	private int vLeft;
	private int vRigth;
	private Boolean isCarroca = false;
	
	//Construtor
	public Peca(int esquerdo, int direito){
		this.vLeft = esquerdo;
		this.vRigth = direito;
		if(vLeft == vRigth){
			this.isCarroca = true;
		}
	}

	//METODOS	
	public Boolean isCarroca(){
		return (vLeft == vRigth);
	}
	
	public void giraPeca(){
		int temp = vLeft;
		vLeft = vRigth;
		vRigth = temp;
	}
	
	public String toString(){
		return "("+vLeft+"|"+vRigth+")";
	}
	
	//Getters e Setters
	public int getvLeft() {
		return vLeft;
	}
	public int getvRigth() {
		return vRigth;
	}
	public Boolean getIsCarroca() {
		return isCarroca;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((isCarroca == null) ? 0 : isCarroca.hashCode());
		result = prime * result + vLeft;
		result = prime * result + vRigth;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Peca other = (Peca) obj;
		if (isCarroca == null) {
			if (other.isCarroca != null)
				return false;
		} else if (!isCarroca.equals(other.isCarroca))
			return false;
		if (vLeft != other.vLeft)
			return false;
		if (vRigth != other.vRigth)
			return false;
		return true;
	}
}
